home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!milyng
- From: mikael@pobox.com (Mikael Lyngvig)
- Subject: Re: Question : link c++ code into C code
- Message-ID: <milyngDM8Ixu.Kyp@netcom.com>
- Sender: milyng@netcom9.netcom.com
- Organization: Hacker's Paradise, Inc.
- X-Newsreader: WinVN 0.99.7
- References: <31110950.136D@genetique.uvsq.fr>
- Date: Sun, 4 Feb 1996 04:53:53 GMT
-
- In article <31110950.136D@genetique.uvsq.fr>, forner@genetique.uvsq.fr says...
-
- >I'd really like to know if it is possible to import C++ functions
- >or libs into a C program.
-
- If you have the source code, you can do like this:
-
- extern "C" int cppFunction(char *pString)
- {
- }
-
-
- If you don't have the source code (and therefore is using a C++ library), you
- have to insert dispatcher functions:
-
- extern "C" int cppFunction(char *pString)
- {
- return libFunction(char *pString);
- }
-
-
- But it would probably be worth it to convert your C code to C++. If your
- program depends upon C++ libraries, it pretty much depends upon the
- availability of a C++ compiler and thus might as well be C++ itself.
-
-
- Mikael
-
-
-